home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / sigvec.man < prev    next >
Encoding:
Text File  |  1990-12-29  |  9.0 KB  |  265 lines

  1.  
  2.  
  3.  
  4. SIGVEC                C Library Procedures                 SIGVEC
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      sigvec - software signal facilities
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssiiggnnaall..hh>>
  13.  
  14.      ssttrruucctt ssiiggvveecc {{
  15.         iinntt    ((**ssvv__hhaannddlleerr))(());;
  16.         iinntt    ssvv__mmaasskk;;
  17.         iinntt    ssvv__ffllaaggss;;
  18.      }};;
  19.  
  20.      ssiiggvveecc((ssiigg,, vveecc,, oovveecc))
  21.      iinntt ssiigg;;
  22.      ssttrruucctt ssiiggvveecc **vveecc,, **oovveecc;;
  23.  
  24. DDEESSCCRRIIPPTTIIOONN
  25.      The system defines a set of signals that may be delivered to
  26.      a process.  Signal delivery resembles the occurence of a
  27.      hardware interrupt: the signal is blocked from further
  28.      occurrence, the current process context is saved, and a new
  29.      one is built.  A process may specify a _h_a_n_d_l_e_r to which a
  30.      signal is delivered, or specify that a signal is to be
  31.      _b_l_o_c_k_e_d or _i_g_n_o_r_e_d.  A process may also specify that a
  32.      default action is to be taken by the system when a signal
  33.      occurs.  Normally, signal handlers execute on the current
  34.      stack of the process.  This may be changed, on a per-handler
  35.      basis, so that signals are taken on a special _s_i_g_n_a_l _s_t_a_c_k.
  36.  
  37.      All signals have the same _p_r_i_o_r_i_t_y.  Signal routines execute
  38.      with the signal that caused their invocation _b_l_o_c_k_e_d, but
  39.      other signals may yet occur.  A global _s_i_g_n_a_l _m_a_s_k defines
  40.      the set of signals currently blocked from delivery to a pro-
  41.      cess.  The signal mask for a process is initialized from
  42.      that of its parent (normally 0).  It may be changed with a
  43.      _s_i_g_b_l_o_c_k(2) or _s_i_g_s_e_t_m_a_s_k(2) call, or when a signal is
  44.      delivered to the process.
  45.  
  46.      When a signal condition arises for a process, the signal is
  47.      added to a set of signals pending for the process.  If the
  48.      signal is not currently _b_l_o_c_k_e_d by the process then it is
  49.      delivered to the process.  When a signal is delivered, the
  50.      current state of the process is saved, a new signal mask is
  51.      calculated (as described below), and the signal handler is
  52.      invoked.  The call to the handler is arranged so that if the
  53.      signal handling routine returns normally the process will
  54.      resume execution in the context from before the signal's
  55.      delivery.  If the process wishes to resume in a different
  56.      context, then it must arrange to restore the previous con-
  57.      text itself.
  58.  
  59.      When a signal is delivered to a process a new signal mask is
  60.  
  61.  
  62.  
  63. Sprite v1.0              January 8, 1986                        1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. SIGVEC                C Library Procedures                 SIGVEC
  71.  
  72.  
  73.  
  74.      installed for the duration of the process' signal handler
  75.      (or until a _s_i_g_b_l_o_c_k or _s_i_g_s_e_t_m_a_s_k call is made).  This mask
  76.      is formed by taking the current signal mask, adding the sig-
  77.      nal to be delivered, and _o_r'ing in the signal mask associ-
  78.      ated with the handler to be invoked.
  79.  
  80.      _S_i_g_v_e_c assigns a handler for a specific signal.  If _v_e_c is
  81.      non-zero, it specifies a handler routine and mask to be used
  82.      when delivering the specified signal.  Further, if the
  83.      SV_ONSTACK bit is set in _s_v__f_l_a_g_s, the system will deliver
  84.      the signal to the process on a _s_i_g_n_a_l _s_t_a_c_k, specified with
  85.      _s_i_g_s_t_a_c_k(2).  If _o_v_e_c is non-zero, the previous handling
  86.      information for the signal is returned to the user.
  87.  
  88.      The following is a list of all signals with names as in the
  89.      include file <_s_i_g_n_a_l._h>:
  90.  
  91.      SIGHUP     1    hangup
  92.      SIGINT     2    interrupt
  93.      SIGDEBUG   3*   force process into debuggable state
  94.      SIGILL     4*   illegal instruction
  95.      SIGTRAP    5*   trace trap
  96.      SIGIOT     6*   IOT instruction
  97.      SIGEMT     7*   EMT instruction
  98.      SIGFPE     8*   floating point exception
  99.      SIGKILL    9    kill (cannot be caught, blocked, or ignored)
  100.      SIGMIG     10   migrate process (cannot be caught, blocked, or ignored)
  101.      SIGSEGV    11*  segmentation violation
  102.      SIGSYS     12*  bad argument to system call
  103.      SIGPIPE    13   write on a pipe with no one to read it
  104.      SIGALRM    14   alarm clock
  105.      SIGTERM    15   software termination signal
  106.      SIGURG     16@  urgent condition present on socket
  107.      SIGSTOP    17'|+'stop (cannot be caught, blocked, or ignored)
  108.      SIGTSTP    18'|+'stop signal generated from keyboard
  109.      SIGCONT    19@  continue after stop (cannot be blocked)
  110.      SIGCHLD    20@  child status has changed
  111.      SIGTTIN    21'|+'background read attempted from control terminal
  112.      SIGTTOU    22'|+'background write attempted to control terminal
  113.      SIGIO      23@  i/o is possible on a descriptor (see _f_c_n_t_l(2))
  114.      SIGXCPU    24   cpu time limit exceeded (see _s_e_t_r_l_i_m_i_t(2))
  115.      SIGXFSZ    25   file size limit exceeded (see _s_e_t_r_l_i_m_i_t(2))
  116.      SIGVTALRM  26   virtual time alarm (see _s_e_t_i_t_i_m_e_r(2))
  117.      SIGPROF    27   profiling timer alarm (see _s_e_t_i_t_i_m_e_r(2))
  118.      SIGWINCH   28@  window size change
  119.      SIGMIGHOME 29   migrate back to home node (cannot be caught, blocked, or ignored)
  120.      SIGUSR1    30   user defined signal 1
  121.      SIGUSR2    31   user defined signal 2
  122.  
  123.      The starred signals in the list above cause the process to
  124.      enter DEBUG state if not caught or ignored.
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0              January 8, 1986                        2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. SIGVEC                C Library Procedures                 SIGVEC
  137.  
  138.  
  139.  
  140.      Once a signal handler is installed, it remains installed
  141.      until another _s_i_g_v_e_c call is made, or an _e_x_e_c_v_e(2) is per-
  142.      formed.  The default action for a signal may be reinstated
  143.      by setting _s_v__h_a_n_d_l_e_r to SIG_DFL; this default is termina-
  144.      tion (with a core image for starred signals) except for sig-
  145.      nals marked with @ or '|+'.  Signals marked with @ are dis-
  146.      carded if the action is SIG_DFL; signals marked with '|+'
  147.      cause the process to stop.  If _s_v__h_a_n_d_l_e_r is SIG_IGN the
  148.      signal is subsequently ignored, and pending instances of the
  149.      signal are discarded.
  150.  
  151.      If a caught signal occurs during certain system calls, the
  152.      call is normally restarted.  The call can be forced to ter-
  153.      minate prematurely with an EINTR error return by setting the
  154.      SV_INTERRUPT bit in _s_v__f_l_a_g_s. The affected system calls are
  155.      _r_e_a_d(2) or _w_r_i_t_e(2) on a slow device (such as a terminal;
  156.      but not a file) and during a _w_a_i_t(2).
  157.  
  158.      After a _f_o_r_k(2) or _v_f_o_r_k(2) the child inherits all signals,
  159.      the signal mask, the signal stack, and the restart/interrupt
  160.      flags.
  161.  
  162.      _E_x_e_c_v_e(2) resets all caught signals to default action and
  163.      resets all signals to be caught on the user stack.  Ignored
  164.      signals remain ignored; the signal mask remains the same;
  165.      signals that interrupt system calls continue to do so.
  166.  
  167. NNOOTTEESS
  168.      The mask specified in _v_e_c is not allowed to block SIGKILL,
  169.      SIGSTOP, or SIGCONT.  This is done silently by the system.
  170.  
  171.      The SV_INTERRUPT flag is not available in 4.2BSD, hence it
  172.      should not be used if backward compatibility is needed.
  173.  
  174. RREETTUURRNN VVAALLUUEE
  175.      A 0 value indicated that the call succeeded.  A -1 return
  176.      value indicates an error occurred and _e_r_r_n_o is set to indi-
  177.      cated the reason.
  178.  
  179. EERRRROORRSS
  180.      _S_i_g_v_e_c will fail and no new signal handler will be installed
  181.      if one of the following occurs:
  182.  
  183.      [EFAULT]       Either _v_e_c or _o_v_e_c points to memory that is
  184.                     not a valid part of the process address
  185.                     space.
  186.  
  187.      [EINVAL]       _S_i_g is not a valid signal number.
  188.  
  189.      [EINVAL]       An attempt is made to ignore or supply a
  190.                     handler for SIGKILL or SIGSTOP.
  191.  
  192.  
  193.  
  194.  
  195. Sprite v1.0              January 8, 1986                        3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. SIGVEC                C Library Procedures                 SIGVEC
  203.  
  204.  
  205.  
  206.      [EINVAL]       An attempt is made to ignore SIGCONT (by
  207.                     default SIGCONT is ignored).
  208.  
  209. SSEEEE AALLSSOO
  210.      kill(1), ptrace(2), kill(2), sigblock(2), sigsetmask(2),
  211.      sigpause(2), sigstack(2), sigvec(2), setjmp(3), siginter-
  212.      rupt(3), tty(4)
  213.  
  214. BBUUGGSS
  215.      This manual page is still confusing.
  216.  
  217. NNOOTTEESS
  218.      The handler routine can be declared:
  219.  
  220.               vvooiidd hhaannddlleerr((ssiigg,, ccooddee,, ssccpp,, aaddddrr))
  221.               iinntt ssiigg,,ccooddee;;
  222.               ssttrruucctt ssiiggccoonntteexxtt **ssccpp;;
  223.               cchhaarr **aaddddrr;;
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261. Sprite v1.0              January 8, 1986                        4
  262.  
  263.  
  264.  
  265.